<template>
  <el-row :gutter="0" class="cart-container">
    <el-col :span="24" class="cart-header">
      <div class="header-left">
        <a :href="getFullPath('/#/shop')">
          <img
            class="mi-logo"
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi.com-assets/shop/img/logo-mi2.png"
            alt="xiaomi-logo"
            loading="lazy"
          />
        </a>
        <span class="cart-title">我的购物车</span>
      </div>
      <div class="header-right" v-if="!userWasLogin">
        <RouterLink :to="{ path: '/auth', query: { type: 'login' } }"
          ><span class="cart-login">登录</span></RouterLink
        >
        <span> | </span>
        <RouterLink :to="{ path: '/auth', query: { type: 'register' } }">
          <span class="cart-register">注册</span></RouterLink
        >
      </div>
    </el-col>
  </el-row>
</template>

<script lang="ts" setup>
  import { getFullPath } from "@/utils/path";

  defineProps({
    userWasLogin: {
      required: true,
      type: Boolean,
      default: false,
    },
  });
</script>

<style lang="scss" scoped>
  @use "../../../../styles/variable.scss" as *;

  .cart-container {
    width: 100%;
    height: 100%;
    background: #f5f5f5;
  }

  .cart-header {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    background: $bsWhite;
    min-height: 100px;
    padding: 0 100px;
    border-bottom: 2px solid $themeColor;
    position: relative;
    z-index: 20;
  }

  .mi-logo {
    width: 56px;
    height: 56px;
    margin: 20px 50px;
  }

  .header-left {
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-items: center;
  }

  .cart-title {
    line-height: 50px;
    color: #424242;
    font-weight: 400;
    font: $bsFont;
    font-size: 28px;
  }

  .header-right {
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-items: center;
    font-size: 10px;

    & > a {
      color: #757575;
      font-weight: 400;
      text-decoration: none;
    }
  }

  .cart-login,
  .cart-register {
    line-height: 50px;
    font-weight: 400;
    font: $bsFont;
    padding: 0 10px;
    text-align: center;
    font-size: 12px;
    text-decoration: none;
  }
</style>
